<template>
<el-config-provider :locale="locale">
  <UIFrameRoot v-if="logined"></UIFrameRoot>
  <UISiteRoot v-if="!logined"></UISiteRoot>
  <CompFactory></CompFactory>
</el-config-provider>
</template>

<script>
import { computed,onMounted,ref } from 'vue'
import { Session, UIMode } from '~/uiframe/services/session'

import UIFrameRoot from '~/uiframe/layout/UIFrameRoot.vue'
import UISiteRoot from '~/uiframe/layout/site/UISiteRoot.vue'

import locale from 'element-plus/dist/locale/zh-cn.mjs'
import { ElConfigProvider } from 'element-plus'

export default {
  components:{
    ElConfigProvider, UIFrameRoot, UISiteRoot
  },
  setup(){
    const resize = ()=>{
      let w = window.innerWidth, h = window.innerHeight;
      UIMode.set(w, h);
    }
    window.addEventListener('resize', resize)
    onMounted(resize);

    const logined = computed(()=> Session.logined.value && -1 == ['guest','newuser'].indexOf(Session.auth.value.prod) )
    document.oncontextmenu = (e)=>{

      /*
      if(e.target.nodeName!=='INPUT'){
        e.preventDefault();
        e.stopPropagation();
      }
      */
    }
    return {
      locale,
      logined
    }
  }
}
</script>

